use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize)]
pub struct PageResult<T> {
    page: i64,
    size: i64,
    total: i64,
    pub list: Vec<T>,
}

impl<T> PageResult<T> {
    pub fn new(page: i64, size: i64, total: i64, list: Vec<T>) -> Self {
        Self {
            page,
            size,
            total,
            list,
        }
    }

    pub fn new_by_pamas(pamas: PagePamas<T>, total: i64, list: Vec<T>) -> Self {
        Self {
            page: pamas.page,
            size: pamas.size,
            total,
            list,
        }
    }
}

#[derive(Deserialize, Serialize)]
pub struct PagePamas<T> {
    pub page: i64,
    pub size: i64,
    pub data: T,
}

impl<T> PagePamas<T> {
    pub fn new(page: i64, size: i64, data: T) -> Self {
        Self { page, size, data }
    }
}
